package uml.view.factory;

import uml.eventsystem.events.UMLEventId;
import uml.util.UMLConstants;
import uml.view.ClassFormatter_View;
import uml.view.UMLContainerView;

/**
 * A factory that creates the formatters for UML view objects. This class uses
 * the <tt>ContainerFactory</tt> to each formatter's container. Each method in
 * this class returns a general formatter object; the exact type is indicated by
 * the method signature.
 * 
 * @author Neil Obetz
 * 
 */

public final class ClassFormatterFactory
{
	public static ClassFormatter_View createFormatter (UMLEventId eventId)
	{
		UMLContainerView view = ContainerFactory.createContainer (eventId);
		ClassFormatter_View formatter = new ClassFormatter_View ();
		formatter.setContainer (view);
		switch (eventId)
		{
			case MAKE_ABSTRACT:
				formatter.setLayer (UMLConstants.CLASS_LAYER);
				formatter.setFontItalic ();
				break;
			case MAKE_SIMPLE_ABSTRACT:
				formatter.setLayer (UMLConstants.CLASS_LAYER);
				formatter.setFontItalic ();
				break;
			case MAKE_CLASS:
				formatter.setLayer (UMLConstants.CLASS_LAYER);
				break;
			case MAKE_SIMPLE:
				formatter.setLayer (UMLConstants.CLASS_LAYER);
				break;
			case MAKE_INTERFACE:
				formatter.setLayer (UMLConstants.INTERFACE_LAYER);
				formatter.setFontItalic ();
				break;
			case MAKE_PACKAGE:
				formatter.setLayer (UMLConstants.PACKAGE_LAYER);
				break;
			case MAKE_NOTE:
				formatter.setLayer (UMLConstants.NOTE_LAYER);
				break;
			default:
				formatter.setFontPlain ();
		}
		return formatter;
	}
}
